package io.github.melin.sqlflow.tree.statement;

import io.github.melin.sqlflow.AstVisitor;
import io.github.melin.sqlflow.tree.Node;
import io.github.melin.sqlflow.tree.NodeLocation;

import java.util.List;
import java.util.Optional;

/**
 * 表示一个空语句，用于初始化分析器时作为占位符
 */
public class EmptyStatement
        extends Statement {

    public EmptyStatement() {
        this(Optional.empty());
    }

    public EmptyStatement(Optional<NodeLocation> location) {
        super(location);
    }

    @Override
    public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
        return visitor.visitNode(this, context);
    }

    @Override
    public List<? extends Node> getChildren() {
        return List.of();
    }

    @Override
    public int hashCode() {
        return 0;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        return (obj != null) && (getClass() == obj.getClass());
    }
}